package com.atguigu.gulimall.search.web;


import com.atguigu.gulimall.search.service.MallSearchService;
import com.atguigu.gulimall.search.vo.SearchParam;
import com.atguigu.gulimall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.io.IOException;

/**
 * @program: gulimall
 * @description: 跳转页面
 * @author: liuxvru
 * @create: 2024-03-06 17:54
 **/
@Controller
public class SearchController {

    @Autowired
    private MallSearchService mallSearchService;
    @GetMapping({"/","list.html"})
    public String listPage(Model mode, SearchParam searchParam) throws IOException {
        SearchResult data= mallSearchService.search(searchParam);
        mode.addAttribute("result",data);
        return "list";
    }

}
